[Single|Double|Or no] Quotes when using grep?

Posted by Hamy on Stack Overflow See other posts from Stack Overflow or by Hamy
Published on 2010-06-09T17:52:35Z Indexed on 2010/06/09 18:12 UTC
Read the original article Hit count: 273

Filed under:
|
|

Grep acts differently depending on what kind of quotes I surround the regex with. I can't seem to get a clear understanding of why this is. Here is an example of the problem:

hamiltont$ grep -e show\(  test.txt 
  variable.show();
  variable.show(a);
  variable.show(abc, 132);
  variableshow();
hamiltont$ grep -e "show\("  test.txt 
grep: Unmatched ( or \(
hamiltont$ grep -e 'show\('  test.txt 
grep: Unmatched ( or \(

I am just assuming there is some proper way to enclose the regex with single/double quotes. Any help?

FWIW, grep --version returns grep (GNU grep) 2.5.1

© Stack Overflow or respective owner

Related posts about regex

Related posts about grep